public class TestDemo {
    public static void main(String[] args) {
        int[] arr = {2,2,1,1,1,2,2};
        find(arr);
    }

    public static void find(int[] arr){
        for (int i = 0; i < arr.length; i++) {
            int count = 1;
            for (int j = i+1; j < arr.length; j++) {
                if(arr[i] == arr[j]){
                    count++;
                }
            }
            if(count > arr.length /2.0){
                System.out.println(arr[i]);
                break;
            }
        }
    }
}
